package tech.yangzhijie.basic.java05;

public class Java04 {
    public static void main(String[] args) {
        int[] ints = moveOddFront(new int[]{6, 8, 4, 2, 4, 3, 9, 7, 1, 5});
        for (int i = 0; i < ints.length; i++) {
            int anInt = ints[i];
            System.out.print(anInt+"\t");
        }
    }

    private static int[] moveOddFront(int[] a){
        for(int i=a.length-1;i>0;i--){
            for(int j=a.length-1;j>0;j--){
                if(a[j]%2==1){
                    int num = a[j-1];
                    a[j-1] = a[j];
                    a[j] = num;
                }
            }
        }
        System.out.println();
        return a;
    }
}
